#ifndef SOCKET_H
#define SOCKET_H
#include "data.h"
#include <boost/shared_ptr.hpp>
#include <QTcpSocket>
#include <QObject>

class Socket : public QObject
{
Q_OBJECT

public:
    typedef boost::shared_ptr<Socket> SocketPtr;

    Socket(QObject *parent);
    ~Socket();
    bool ConnectServer(const QString &addr, quint16 port);
    bool DisConnectServer();
    void RecvData(Data::DataPtr& data);
    int SendData(Data::DataPtr& data);

signals:
    void dataReady();

public slots:
    void prepareData();

private:    
    QTcpSocket *sockPtr;
    bool isDataHead;
    unsigned char data[320*240*3];
    int         data_size;
    int currPtr;

};

#endif // SOCKET_H
